package com.sunwoda.springbootredis.controller;

import com.sunwoda.springbootredis.entity.User;
import com.sunwoda.springbootredis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类描述：
 *
 * @ClassName RedisTemplateController
 * @Description TODO
 * @Author shiguorang
 * @Date 2021/9/12 10:10
 * @Version 1.0
 */
@RestController
@RequestMapping("/RedisTemplate")
public class RedisTemplateController {

    /**
     * RedisTemplate 默认使用的是JDK的序列化策略
     * RedisTemplate存储在Redis的键值都是经过序列化的
     */

    @Autowired
    private RedisTemplate redisTemplate;

    @Resource
    private UserService userService;


    /**
     * @description: null
     * @param:
     * @return:
     * @author shiguorang
     * @date: 2021/9/12 10:34
     */
    @GetMapping(value = "/opsDate")
    public void opsDate(){
        this.userService.opsDate();
    }
}
